import { ExecutionContext, CanActivate, Injectable } from "@nestjs/common";
import { Reflector } from "@nestjs/core";

@Injectable()
export class PermissionGuard implements CanActivate {
    constructor(private reflector: Reflector) {}
    async canActivate(context: ExecutionContext): Promise<boolean> {
        //	NOTE: 获取自定义装饰器信息
        const permissionKey = this.reflector.get<string[]>('permission', context.getHandler())
        console.log("当前权限key：", permissionKey)

        return true;
    }
}


